class CreateScheduleIntervals < ActiveRecord::Migration
  def self.up
    create_table :schedule_intervals do |t|
      t.references :schedule
      t.references :interval

      t.timestamps
    end

    add_index(:schedule_intervals, [:schedule_id, :interval_id], :unique => true)
    add_index(:schedule_intervals, :schedule_id, :unique => false)
  end

  def self.down
    remove_index(:schedule_intervals, [:schedule_id, :interval_id])
    remove_index(:schedule_intervals, :schedule_id)
    drop_table :schedule_intervals
  end
end
